//
//  NextVinstitutionService.m
//  HZHome
//
//  Created by Alawn on 13-10-15.
//  Copyright (c) 2013年 xzysun. All rights reserved.
//

#import "NextVinstitutionService.h"
#import "VolunteerCell.h"
#import "VinstitutionEntity.h"
#import "CommonMineQueryItem.h"
@implementation NextVinstitutionService
-(id)init
{
    self = [super init];
    if (self) {
        _dataItemName = @"VinstitutionEntity";
    }
    return self;
}

-(void)loadDataWithKey:(NSString *)keyOrNil
{
    _currentPageNo = 1;//刷新或查询的时候将请求页码变为1
    if (self.dataList) {
        self.dataList = nil;
    }
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    VinstitutionEntity *item = (VinstitutionEntity *)self.dataItem;
    NSString *strId=[NSString stringWithFormat:@"%@",item.Id];
    if ([strId compare:@"12"]==NSOrderedSame || item == nil) {
        NSString *categoryid=@"19,21,22,23";
        [params setValue:categoryid forKey:@"categoryid"];
    }
    else
    {
        [params setValue:item.Id forKey:@"categoryid"];
    }
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"title"];
    } else {
        [params setValue:@"" forKey:@"title"];
    }
    [self doHttpPost:WOYAOCHA headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
}

-(void)loadMoreDataWithKey:(NSString *)keyOrNil
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    VinstitutionEntity *item = (VinstitutionEntity *)self.dataItem;
    NSString *strId=[NSString stringWithFormat:@"%@",item.Id];
    if ([strId compare:@"12"]==NSOrderedSame) {
        NSString *categoryid=@"19,21,22,23";
        [params setValue:categoryid forKey:@"categoryid"];
    }
    else
    {
        [params setValue:item.Id forKey:@"categoryid"];
    }
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"title"];
    } else {
        [params setValue:@"" forKey:@"title"];
    }
    [self doHttpPost:WOYAOCHA headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
}
-(void)configCell:(UITableViewCell *)cell atIndex:(NSIndexPath *)index
{
    VinstitutionEntity *item = [self.dataList objectAtIndex:index.row];
    VolunteerCell *tempCell = (VolunteerCell *)cell;
    tempCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    tempCell.titleLabel.text = item.title;
}

@end
